package top.whysu.gps.dto.page;

/**
 * 分页查询基础DTO，提供公用的基础变量
 */
public class BasePagerDTO {


    /**
     * 当前页页码
     */
    private int pageNum = 1;

    /**
     * 每页记录数
     */
    private int pageSize = 10;

    /**
     * 排序字段，支持多字段排序
     */
    private OrderByDTO[] orders;

    public BasePagerDTO() {
    }

    public BasePagerDTO(int pageNo, int pageSize) {
        this.pageNum = pageNo;
        this.pageSize = pageSize;
    }

    public int getStartIndex() {
        int startIndex = (this.pageNum - 1) * this.pageSize;
        return startIndex < 0 ? 0 : startIndex;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public OrderByDTO[] getOrders() {
        return orders;
    }

    public void setOrders(OrderByDTO[] orders) {
        this.orders = orders;
    }

}
